<template>
	<view class="container" :style="{backgroundColor:pageinfo.bgcolor}">
		<dp :pagecontent="pagecontent"></dp>
		<block v-if="xixie">
			<dp-xixie-mendian-log></dp-xixie-mendian-log>
		</block>
		<view v-if="copyright!=''" class="copyright" @tap="goto" :data-url="copyright_link">{{copyright}}</view>
		<dp-tabbar :opt="opt"></dp-tabbar>
		<popmsg ref="popmsg"></popmsg>
		<popmsg ref="popmsg"></popmsg>
	</view>
</template>

<script>
	var app = getApp();
	export default {
		data() {
			return {
				opt: {},
				loading: false,
				isload: false,
				pageinfo: [],
				pagecontent: [],
				copyright: '',
				copyright_link: '',
				xixie: false
			}
		},
		onLoad: function(opt) {
			this.opt = app.getopts(opt);
			this.getdata();
		},
		onPullDownRefresh: function(e) {
			this.getdata();
		},
		methods: {
			getdata: function() {
				var that = this;
				that.loading = true;
				app.get('ApiMy/usercenter', {}, function(data) {
					that.loading = false;
					let list = data.pagecontent;
					list.forEach((item,index) =>{
						if(item.data != "" && item.temp == 'menu'){
							let listArr = item.data;
							for(let i = 0 ; i < listArr.length ; i++){
								if(listArr[i].text == '管理后台'){
									if (uni.getStorageSync('loginStatus') == true) {
										listArr[i].hrefurl = '/admin/index/index';
									}
								}
							}
						}
					})
					let munData = data.pagecontent;
					that.pageinfo = data.pageinfo;
					that.pagecontent = munData;
					that.copyright = data.copyright;
					that.copyright_link = data.copyright_link || '';
					uni.setNavigationBarTitle({
						title: data.pageinfo.title
					});
					if (data.xixie) {
						that.xixie = data.xixie;
					}
					// that.loaded();
				});
			}
		}
	}
</script>
<style>

</style>